package com.ep.modules.app.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ep.common.utils.PageUtils;
import com.ep.modules.app.dao.AppTaskChangeLogMapper;
import com.ep.modules.app.entity.AppTaskChangeLog;
import com.ep.modules.app.entity.AppTaskChangeLogExample;
import com.ep.modules.app.service.AppTaskChangeLogService;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AppTaskChangeLogServiceImpl implements AppTaskChangeLogService {
    @Autowired
    private AppTaskChangeLogMapper appTaskChangeLogMapper;

    public PageUtils queryPage(Map<String, Object> params) {
        String searchKey = (String)params.get("searchKey");
        Long searchUserId = (Long)params.get("searchUserId");
        AppTaskChangeLogExample example = new AppTaskChangeLogExample();
        AppTaskChangeLogExample.Criteria criteria = example.createCriteria();
        List<AppTaskChangeLog> list = appTaskChangeLogMapper.selectByExample(example);
        Page<AppTaskChangeLog> page = new Page<>();
        page.setRecords(list);
        return new PageUtils(page);
    }

    public AppTaskChangeLog getById(Long id) {
        return appTaskChangeLogMapper.selectByPrimaryKey(id.intValue());
    }

    public void save(AppTaskChangeLog entity) {
        appTaskChangeLogMapper.insert(entity);
    }

    public void update(AppTaskChangeLog entity) {
        appTaskChangeLogMapper.updateByPrimaryKeySelective(entity);
    }

    public void deleteBatch(Long[] ids) {
        for (Long id : ids) {
                appTaskChangeLogMapper.deleteByPrimaryKey(id.intValue());
        }
    }
}